Skip to content

Add support for DDL generation/migrations#9

Merged
alex-clickhouse merged 13 commits intomainfrom
migrations
Apr 15, 2026
Merged

Add support for DDL generation/migrations#9
alex-clickhouse merged 13 commits intomainfrom
migrations

Conversation

@alex-clickhouse
Copy link
Copy Markdown
Collaborator

No description provided.

@alex-clickhouse alex-clickhouse changed the title Add support for migrations Add support for DDL/migrations Apr 13, 2026
@alex-clickhouse alex-clickhouse changed the title Add support for DDL/migrations Add support for DDL generation/migrations Apr 13, 2026
@alex-clickhouse alex-clickhouse requested a review from Copilot April 13, 2026 12:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds EF Core DDL/migrations support for the ClickHouse provider, including engine-specific table DDL, annotation flow through migrations/model differ, design-time services for dotnet-ef, and broad unit/integration/CLI smoke test coverage.

Changes:

  • Implement ClickHouse-specific migrations SQL generation (CREATE TABLE with ENGINE clauses, ALTER COLUMN removals, skipping indexes, create/drop database ops) and history repository behavior.
  • Add ClickHouse engine/DDL fluent APIs + conventions (default MergeTree + ORDER BY behavior) and propagate annotations through design-time/migrations.
  • Add integration and CLI smoke tests (Testcontainers + dotnet-ef) and wire CI to install dotnet-ef.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
test/EFCore.ClickHouse.Tests/MigrationSqlGeneratorTests.cs Unit tests for generated migration SQL (engines, expressions, removals, indexes).
test/EFCore.ClickHouse.Tests/MigrationIntegrationTests.cs Integration tests verifying applied migration effects via ClickHouse system tables.
test/EFCore.ClickHouse.Tests/EnsureCreatedTests.cs Integration tests for EnsureCreated/EnsureDeleted behavior against ClickHouse.
test/EFCore.ClickHouse.Tests/EngineConfigurationTests.cs Unit tests for fluent engine configuration annotations and conventions.
test/EFCore.ClickHouse.Tests/EFCore.ClickHouse.Tests.csproj Adds EFCore.Design dependency for test scenarios.
test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs End-to-end dotnet-ef CLI smoke tests against a real ClickHouse instance.
test/EFCore.ClickHouse.DesignSmoke/SmokeDbContext.cs Design-time DbContext + factory used by CLI smoke tests.
test/EFCore.ClickHouse.DesignSmoke/Program.cs Minimal entry point for dotnet-ef discovery.
test/EFCore.ClickHouse.DesignSmoke/EFCore.ClickHouse.DesignSmoke.csproj Standalone smoke project referencing provider + EFCore.Design.
src/EFCore.ClickHouse/Migrations/Operations/ClickHouseDropDatabaseOperation.cs New migration operation for dropping databases.
src/EFCore.ClickHouse/Migrations/Operations/ClickHouseCreateDatabaseOperation.cs New migration operation for creating databases.
src/EFCore.ClickHouse/Migrations/Internal/ClickHouseMigrationsAnnotationProvider.cs Ensures ClickHouse annotations are carried onto “remove” operations.
src/EFCore.ClickHouse/Migrations/Internal/ClickHouseMigrationDatabaseLock.cs No-op migrations lock implementation for ClickHouse.
src/EFCore.ClickHouse/Migrations/Internal/ClickHouseHistoryRepository.cs ClickHouse-specific migrations history table + idempotent-script rejection.
src/EFCore.ClickHouse/Migrations/ClickHouseMigrationsSqlGenerator.cs Core migration SQL generator implementation for ClickHouse DDL/DML ops.
src/EFCore.ClickHouse/Metadata/Internal/ClickHouseAnnotationProvider.cs Adds annotation emission from model/table/index/column into relational model.
src/EFCore.ClickHouse/Metadata/Internal/ClickHouseAnnotationNames.cs Expands annotation constants for engines, settings, columns, and skipping indexes.
src/EFCore.ClickHouse/Metadata/Conventions/ClickHouseDefaultEngineConvention.cs Sets default MergeTree + default ORDER BY behavior at model finalization.
src/EFCore.ClickHouse/Metadata/Conventions/ClickHouseConventionSetBuilder.cs Removes FK conventions and adds default engine convention.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseVersionedCollapsingMergeTreeEngineBuilder.cs Fluent builder for VersionedCollapsingMergeTree-specific configuration.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseSummingMergeTreeEngineBuilder.cs Fluent builder for SummingMergeTree-specific configuration.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseSimpleEngineBuilder.cs Fluent builder enforcing restrictions for “simple” engines (Memory/Log/etc.).
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseReplacingMergeTreeEngineBuilder.cs Fluent builder for ReplacingMergeTree-specific configuration.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseMergeTreeEngineBuilder.cs Fluent builder for MergeTree configuration.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseGraphiteMergeTreeEngineBuilder.cs Fluent builder for GraphiteMergeTree configuration.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseEngineBuilder.cs Base fluent builder implementing shared table options (ORDER BY, TTL, settings, etc.).
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseCollapsingMergeTreeEngineBuilder.cs Fluent builder for CollapsingMergeTree configuration.
src/EFCore.ClickHouse/Metadata/Builders/ClickHouseAggregatingMergeTreeEngineBuilder.cs Fluent builder for AggregatingMergeTree configuration.
src/EFCore.ClickHouse/Infrastructure/Internal/ClickHouseModelValidator.cs Adds engine configuration validation/warnings in model validator.
src/EFCore.ClickHouse/Extensions/ClickHouseServiceCollectionExtensions.cs Registers migrations services (SQL generator, history repo, annotation provider).
src/EFCore.ClickHouse/Extensions/ClickHousePropertyExtensions.cs Adds property-level annotation accessors (codec/ttl/comment).
src/EFCore.ClickHouse/Extensions/ClickHousePropertyBuilderExtensions.cs Adds fluent APIs for property codec/ttl/comment.
src/EFCore.ClickHouse/Extensions/ClickHouseIndexExtensions.cs Adds index-level annotation accessors for skipping indexes.
src/EFCore.ClickHouse/Extensions/ClickHouseIndexBuilderExtensions.cs Adds fluent APIs for skipping index type/granularity/params.
src/EFCore.ClickHouse/Extensions/ClickHouseEntityTypeExtensions.cs Adds entity/table-level annotation accessors (engine, order by, ttl, settings, etc.).
src/EFCore.ClickHouse/Extensions/ClickHouseEntityTypeBuilderExtensions.cs Adds ToTable(...).Has*Engine() fluent entry points.
src/EFCore.ClickHouse/EFCore.ClickHouse.csproj Adds EFCore.Design reference to runtime package.
src/EFCore.ClickHouse/Design/Internal/ClickHouseDesignTimeServices.cs Registers design-time services for tooling (dotnet-ef).
src/EFCore.ClickHouse/Design/Internal/ClickHouseCodeGenerator.cs Provider code generator for UseClickHouse(...) scaffolding output.
src/EFCore.ClickHouse/Design/Internal/ClickHouseAnnotationCodeGenerator.cs Ensures ClickHouse-prefixed annotations are not treated as convention-handled.
README.md Documents engine configuration + migrations support and limitations.
ClickHouse.EntityFrameworkCore.sln Adds the new DesignSmoke project to the solution.
.github/workflows/tests.yml Installs dotnet-ef in CI before restore/build/test.
.github/workflows/coverage.yml Installs dotnet-ef in CI before coverage run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EFCore.ClickHouse/Migrations/ClickHouseMigrationsSqlGenerator.cs Outdated
Comment thread src/EFCore.ClickHouse/EFCore.ClickHouse.csproj Outdated
Comment thread .github/workflows/tests.yml Outdated
Comment thread .github/workflows/coverage.yml Outdated
@alex-clickhouse
Copy link
Copy Markdown
Collaborator Author

@codex[agent] review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 45 changed files in this pull request and generated 14 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/EFCore.ClickHouse.Tests/EnsureCreatedTests.cs Outdated
Comment thread test/EFCore.ClickHouse.Tests/EnsureCreatedTests.cs Outdated
Comment thread test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs
Comment thread test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs
Comment thread test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs
Comment thread .github/workflows/coverage.yml Outdated
dotnet-version: 10.x

- name: Install dotnet-ef
run: dotnet tool install --global dotnet-ef
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow installs dotnet-ef without a version pin. To keep CI deterministic and compatible with the EF Core version referenced by the projects, pin the tool version (e.g., --version 10.0.2 / 10.*).

Suggested change
run: dotnet tool install --global dotnet-ef
run: dotnet tool install --global dotnet-ef --version 10.0.2

Copilot uses AI. Check for mistakes.
Comment thread test/EFCore.ClickHouse.Tests/EnsureCreatedTests.cs Outdated
Comment thread test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs
Comment thread test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs
@alex-clickhouse alex-clickhouse merged commit 522b03a into main Apr 15, 2026
3 checks passed
@alex-clickhouse alex-clickhouse deleted the migrations branch April 15, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants